package 蓝桥真题;
import java.io.*;
import java.util.*;
public class 单词分析 {
	   static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	   final static int N=1010;
	   static int []ct=new int[26];
	   public static void main(String[]args)throws Exception{
		      char[]word=br.readLine().toCharArray();
		      int max=-0x3f3f3f3f,idx=-1;
		      for(int i=0;i<word.length;i++){
		    	  int c=word[i]-'a';
		    	  if(++ct[c]>max){
		    		  idx=c;
		    		  max=ct[c];
		    	  }else if(ct[c]==max&&c<idx)idx=c;
		      }
		      System.out.println((char)(idx+'a'));
		      System.out.println(ct[idx]);
	   }
       
}
